package com.remontee.mecanique.mvc.model;

import com.remontee.mecanique.mvc.controller.ConfigController;
import com.remontee.mecanique.mvc.utils.LoiEnum;

/** 
 * @author Michel
 */
public class ConfigurationModel extends AbstractModel {

	private String name = "";
	private int vitesse = 0;
	private int distance = 0;
	private int capacite = 0;
	private int longueurRemontee = 0;
	private int longueurDescente = 0;
	private int vitesseDescente = 0;
	private String loiEntree = "";
	private int debitEntree = 0;
	private String loiSortie = "";
	private int debitSortie = 0;

	/**
	 * Default constructor
	 */
	public ConfigurationModel() {
	}

	/**
	 * Provides the means to set or reset the model to a default state.
	 */
	public void initDefault() {

		setName("Default config");
		setVitesse(5);
		setDistance(2);
		setCapacite(1);
		setLongueurRemontee(2);
		setLongueurDescente(5);
		setVitesseDescente(6);
		setLoiEntree(LoiEnum.LOI_DE_POISSON.toString());
		setDebitEntree(2);
		setLoiSortie(LoiEnum.LOI_DE_POISSON.toString());
		setDebitSortie(2);

	}

	// Accessors

	public String getName() {
		return name;
	}

	public void setName(String name) {

		String oldName = this.name;
		this.name = name;

		firePropertyChange(ConfigController.CONFIG_NAME_PROPERTY, oldName, name);
	}

	public int getVitesse() {
		return vitesse;
	}

	public void setVitesse(int vitesse) {

		int oldVitesse = this.vitesse;
		this.vitesse = vitesse;

		firePropertyChange(ConfigController.CONFIG_NAME_PROPERTY, oldVitesse,
				vitesse);
	}

	public int getCapacite() {
		return capacite;
	}

	public void setCapacite(int capacite) {
		int oldCapacite = this.capacite;
		this.capacite = capacite;

		firePropertyChange(ConfigController.CONFIG_CAPACITE_PROPERTY,
				oldCapacite, capacite);
	}

	public int getDebitEntree() {
		return debitEntree;
	}

	public void setDebitEntree(int debitEntree) {
		int oldDebitEntree = this.debitEntree;
		this.debitEntree = debitEntree;

		firePropertyChange(ConfigController.CONFIG_DEBITENTREE_PROPERTY,
				oldDebitEntree, debitEntree);
	}

	public int getDebitSortie() {
		return debitSortie;
	}

	public void setDebitSortie(int debitSortie) {
		int oldDebitSortie = this.debitSortie;
		this.debitSortie = debitSortie;

		firePropertyChange(ConfigController.CONFIG_DEBITSORTIE_PROPERTY,
				oldDebitSortie, debitSortie);
	}

	public int getDistance() {
		return distance;
	}

	public void setDistance(int distance) {
		int oldDistance = this.distance;
		this.distance = distance;

		firePropertyChange(ConfigController.CONFIG_DISTANCE_PROPERTY,
				oldDistance, distance);
	}

	public String getLoiEntree() {
		return loiEntree;
	}

	public void setLoiEntree(String loiEntree) {
		String oldLoiEntree = this.loiEntree;
		this.loiEntree = loiEntree;

		firePropertyChange(ConfigController.CONFIG_LOIENTREE_PROPERTY,
				oldLoiEntree, loiEntree);
	}

	public String getLoiSortie() {
		return loiSortie;
	}

	public void setLoiSortie(String loiSortie) {
		String oldLoiSortie = this.loiSortie;
		this.loiSortie = loiSortie;

		firePropertyChange(ConfigController.CONFIG_LOISORTIE_PROPERTY,
				oldLoiSortie, loiSortie);
	}

	public int getLongueurDescente() {
		return longueurDescente;
	}

	public void setLongueurDescente(int longueurDescente) {
		int oldLongueurDescente = this.longueurDescente;
		this.longueurDescente = longueurDescente;

		firePropertyChange(ConfigController.CONFIG_LONGUEURDESCENTE_PROPERTY,
				oldLongueurDescente, longueurDescente);
	}

	public int getLongueurRemontee() {
		return longueurRemontee;
	}

	public void setLongueurRemontee(int longueurRemontee) {
		int oldLongueurRemontee = this.longueurRemontee;

		firePropertyChange(ConfigController.CONFIG_LONGUEURREMONTEE_PROPERTY,
				oldLongueurRemontee, longueurRemontee);
	}

	public int getVitesseDescente() {
		return vitesseDescente;
	}

	public void setVitesseDescente(int vitesseDescente) {
		int oldVitesseDescente = this.vitesseDescente;
		this.vitesseDescente = vitesseDescente;

		firePropertyChange(ConfigController.CONFIG_VITESSEDESCENTE_PROPERTY,
				oldVitesseDescente, vitesseDescente);
	}

}
